﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using T1CHEN;

namespace T1练习
{
    class Program
    {
        static void Main(string[] args)
        {
            //初始3个游戏
            game mv1 = new game();
            mv1.name = "纪念碑谷";
            mv1.category = "冒险解谜类手机游戏";
            mv1.price = 30;
            mv1.stock = 100;
            mv1.addtime = DateTime.Now; //添加日期为今天

            game mv2 = new game();
            mv2.name = "刺客信条";
            mv2.category = "角色扮演类手机游戏";
            mv2.price = 28;
            mv2.stock = 100;
            mv2.addtime = DateTime.Now;//添加日期为今天

            game mv3 = new game();
            mv3.name = "鳄鱼爱洗澡";
            mv3.category = "休闲益智类手机游戏";
            mv3.price = 6;
            mv3.stock = 100;
            mv3.addtime = DateTime.Now;//添加日期为今天




            //定义游戏数组，将3个游戏对象存储在数组中
            game[] gameList = new game[3];
            gameList[0] = mv1;
            gameList[1] = mv2;
            gameList[2] = mv3;
            //遍历数组，打印游戏列表
            Console.WriteLine("序号\t游戏名称\t\t游戏类型\t\t游戏价格\t库存数量");
            for (int i = 0; i < gameList.Length; i++)
            {
                Console.WriteLine(i + "\t《" + gameList[i].name + "》\t\t" + gameList[i].category + "\t" + gameList[i].price + "\t\t" + gameList[i].stock);
            }
            Console.WriteLine("====================游戏入库=========================");
            //调用Store()方法实现游戏入库10份
            gameList[0].Store(10);
            gameList[1].Store(10);
            gameList[2].Store(10);


            Console.WriteLine("====================游戏销售=========================");
            //调用Sale()方法实现游戏销售2份
            gameList[0].Sale(2);
            gameList[1].Sale(2);
            gameList[2].Sale(2);


        }
    }
}
